home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DLLCust_Files / AXON / BK2NDORD.C < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  900 b   |  26 lines

  1. // Dynamic link library implementation of second order neuron
  2.  
  3. #include "NSDLL.h" 
  4.  
  5. /* Backpropagation of component */
  6.  
  7. __declspec(dllexport) void performBackAxon(
  8.     DLLData    *instance,    // Pointer to instance data
  9.     DLLData    *dualInstance,    // Pointer to the forward axons instance data
  10.     NSFloat    *data,         // Pointer to the layer of processing elements (PEs)
  11.     int     rows,        // Number of rows of PEs in the layer
  12.     int     cols,        // Number of columns of PEs in the layer
  13.     NSFloat    *error         // Pointer to the sensitivity vector
  14.     )
  15. {
  16.     int i, length=rows*cols;
  17.     NSFloat lastX=1.0f, currentX=data[0], runningX;
  18.     
  19.     for (i=1; i<length; i++) {
  20.         runningX = data[i]/currentX;
  21.         error[i] = error[i]*lastX + error[i+1]*runningX;
  22.         lastX = currentX;
  23.         currentX = runningX;
  24.     }                                                                                                                          
  25. }
  26.